#ifndef __LINKSTACK_H_
#define __LINKSTACK_H_

#include"DoubleLinkvoid.h"

class LinkStack
{
public:
    using ElementType= DoubleLinkList::ElementType;
    //入栈
    void Push(const ElementType& data)
    {
        list.InsertTail(data);
    }
    
    void Pop()
    {
        list.RemoveByIndex(list.Size()-1);
    }

    ElementType* GetTop()
    {
        if(list.Size()==0)
            return nullptr;
        return list.back();
    }

    bool IsEmpty()
    {
        return list.Size()==0;
    }

private:
    DoubleLinkList list;
};

#endif